<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .box {
            width: 100%;
            height:auto;
            background-color: #ccc;
            padding-top:5px;
        }
        .time {
            width:6rem;
            height: 6rem;
            line-height: 6rem;
            margin-bottom:0.25rem;
            margin-left: calc((100% - 6rem)/2);
            border: 1px solid red;
            font-size:30px;
            text-align: center;
            margin-top:5px;
            font-size: .35rem;
        }
        .app_box {
            width:6rem;
            height: auto;
            margin-left: calc((100% - 6rem)/2);
        }
        .app_box div{
            width: 1.8rem;
            height: 1.8rem;
            float: left;
            margin-right: calc((100% - 5.4rem)/2);
            text-align: center;
            line-height:2rem;
            border: 1px solid red;
            box-sizing: border-box;
            font-size:.35rem;
        }
        .app_box div:last-child{
            margin-right: 0px;
        }
        .clearfix:before,
        .clearfix:after {
            content:"";
            display: block;
            height: 0;
            line-height: 0;
            visibility: hidden;
            clear: both;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="time">
            这里是测试时间的box
        </div>
        <div class="app_box clearfix">
            <div class="app1">app1</div>
            <div class="app2">app2</div>
            <div class="app3">app3</div>
        </div>
    </div>
</body>
<script src="jquery.min.js"></script>
<script>


//    这是rem布局的核心代码，这段代码的大意是：
//    如果页面的宽度超过了640px，那么页面中html的font-size恒为100px，
// 否则，页面中html的font-size的大小为： 100 * (当前页面宽度 / 640)


    (function (doc, win) {
        var docEl = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEl.clientWidth;
                    if (!clientWidth) return;
                    if(clientWidth>=640){
                        docEl.style.fontSize = '100px';
                    }else{
                        docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
                    }
                };

        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);




    $(function(){

    })

</script>
</html>